\subsection{Introduction}
Let \( M \) and \( N \) be \( R \)-modules.
Informally, the tensor product of \( M \) and \( N \) over \( R \) is the set \( M \otimes_R N \) of all sums
\[ \sum_{i=1}^\ell m_i \otimes n_i;\quad m_i \in M, n_i \in N \]
subject to the relations
\begin{align*}
    (m_1 + m_2) \otimes n &= m_1 \otimes n + m_2 \otimes n \\
    m \otimes (n_1 + n_2) &= m \otimes n_1 + m \otimes n_2 \\
    (rm) \otimes n &= r(m \otimes n) \\
    m \otimes (rn) &= r(m \otimes n)
\end{align*}
This is a module that abstracts the notion of bilinearity between two modules.
\begin{example}
    Consider \( \faktor{\mathbb Z}{2\mathbb Z} \otimes_{\mathbb Z} \faktor{\mathbb Z}{3\mathbb Z} \).
    In this \( \mathbb Z \)-module,
    \[ x \otimes y = (3x) \otimes y = x \otimes (3y) = x \otimes 0 = x \otimes (0 \cdot 0) = 0 (x \otimes 0) = 0 \]
    Hence \( \faktor{\mathbb Z}{2\mathbb Z} \otimes_{\mathbb Z} \faktor{\mathbb Z}{3\mathbb Z} = 0 \).
\end{example}
\begin{example}
    Now consider \( {\mathbb R}^n \otimes_{\mathbb R} {\mathbb R}^\ell \).
    We will show later that this is isomorphic to \( \mathbb R^{n+\ell} \).
\end{example}

\subsection{Definition and universal property}
\begin{definition}
    A map of \( R \)-modules \( f : M \times N \to L \) is \emph{\( R \)-bilinear} if for each \( m_0 \in M \) and \( n_0 \in N \), the maps \( n \mapsto f(m_0, n) \) and \( m \mapsto f(m, n_0) \) are \( R \)-linear (or equivalently, a homomorphism of \( R \)-modules).
\end{definition}
\begin{definition}
    Let \( M, N \) be \( R \)-modules.
    Let \( \mathcal F = R^{\oplus(M \times N)} \) be the free \( R \)-module with coordinates indexed by \( M \times N \).
    Define \( K \subseteq \mathcal F \) to be the submodule generated by the following set of relations:
    \begin{align*}
        &(m_1 + m_2, n) - (m_1, n) - (m_2, n) \\
        &(m, n_1 + n_2) - (m, n_1) - (m, n_2) \\
        &r (m, n) - (rm, n) \\
        &r (m, n) - (m, rn)
    \end{align*}
    The \emph{tensor product} \( M \otimes_R N \) is \( \faktor{\mathcal F}{K} \).
    We further define the \( R \)-bilinear map
    \[ i_{M \otimes N} : M \times N \to M \otimes N;\quad i_{M \otimes N}(m, n) = e_{(m, n)} = m \otimes n \]
\end{definition}
\begin{proposition}[universal property of the tensor product]
    The pair \( (M \otimes_R N, i_{M \otimes_R N}) \) satisfies the following universal property.
    For every \( R \)-module \( L \) and every \( R \)-bilinear map \( f : M \times N \to L \), there exists a unique homomorphism \( h : M \otimes_R N \to L \) such that the following diagram commutes.
    \[\begin{tikzcd}
        {M \times N} & {M \otimes_R N} \\
        & L
        \arrow["{i_{M \otimes_R N}}", from=1-1, to=1-2]
        \arrow["h", dashed, from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    Equivalently, \( h \circ i_{M \otimes_R N} = f \).
\end{proposition}
\begin{proof}
    The conclusion \( h \circ i_{M \otimes N} = f \) holds if and only if for all \( m, n \), we have
    \[ h(m \otimes n) = f(m, n) \]
    Note that the elements \( \qty{m \otimes n} \) generate \( M \otimes N \) as an \( R \)-module, so there is at most one \( h \).
    We now show that the definition of \( h \) on the pure tensors \( m \otimes n \) extends to an \( R \)-linear map \( M \otimes N \to L \).
    The map \( R^{\oplus(M \otimes N)} \to L \) given by \( (m, n) \mapsto f(m, n) \) exists by the universal property of the direct sum.
    However, this map vanishes on the generators of \( K \), so it factors through the quotient \( \faktor{\mathcal F}{K} \) as required.
\end{proof}
The universal property given above characterises the tensor product up to isomorphism.
\begin{proposition}
    Let \( M, N \) be \( R \)-modules, and \( (T, j) \) be an \( R \)-module and an \( R \)-bilinear map \( M \times N \to T \).
    Suppose that \( (T, j) \) satisfies the same universal property as \( M \otimes N \).
    Then there is a unique isomorphism of \( R \)-modules \( \varphi : M \otimes N \similarrightarrow T \) such that \( \varphi \circ i_{M \otimes N} = j \).
\end{proposition}
\begin{proof}
    By using the universal property of \( M \otimes N \) and \( T \), we obtain \( \varphi \) and \( \psi \) as follows.
    \[\begin{tikzcd}
        {M \otimes N} && T \\
        & {M \times N}
        \arrow["{i_{M \otimes N}}", from=2-2, to=1-1]
        \arrow["j"', from=2-2, to=1-3]
        \arrow["\varphi", shift left, dashed, from=1-1, to=1-3]
        \arrow["\psi", shift left, dashed, from=1-3, to=1-1]
    \end{tikzcd}\]
    The universal property states that \( \varphi \circ i_{M \otimes N} = j \) and \( \psi \circ j = i_{M \otimes N} \).
    Hence, \( \psi \circ \varphi \circ i_{M \otimes N} = i_{M \otimes N} \).
    This means that the following diagram commutes.
    \[\begin{tikzcd}
        {M \times N} && {M \otimes N} \\
        && {M \otimes N}
        \arrow["{i_{M \otimes N}}", from=1-1, to=1-3]
        \arrow["\id"', shift right=2, from=1-3, to=2-3]
        \arrow["{i_{M \otimes N}}"', from=1-1, to=2-3]
        \arrow["{\psi \circ \varphi}", shift left=2, from=1-3, to=2-3]
    \end{tikzcd}\]
    By the uniqueness condition of the universal property, \( \id = \psi \circ \varphi \).
    Similarly, \( \id = \varphi \circ \psi \).
    Hence, \( \varphi \) is an isomorphism \( M \otimes N \to T \) with \( \varphi \circ i_{M \otimes N} = j \).
    Uniqueness of \( \varphi \) is guaranteed by the universal property: it is the only solution to \( \varphi \circ i_{M \otimes N} = j \).
\end{proof}
In particular, we have
\[ \operatorname{Bilin}_R(M \times N, L) \similarrightarrow \Hom(M \otimes_R N, L) \]
given by the universal property, and the inverse is given by \( h \mapsto h \circ i_{M \otimes N} \).

\subsection{Zero tensors}
\begin{proposition}
    Let \( M, N \) be \( R \)-modules.
    Then
    \[ \sum m_i \otimes n_i = 0 \]
    if and only if for every \( R \)-module \( L \) and every \( R \)-bilinear map \( f : M \times N \to L \), we have
    \[ \sum f(m_i, n_i) = 0 \]
\end{proposition}
To show an element of \( M \otimes N \) is nonzero, it suffices to find a single \( R \)-module \( L \) and bilinear map \( M \times N \to L \) with mapping the required sum to a nonzero value.
\begin{proof}
    Assume \( \sum m_i \otimes n_i = 0 \).
    \( f \) factors through the map \( i_{M \otimes N} \), giving
    \[\begin{tikzcd}
        {M \times N} & {M \otimes N} \\
        & L
        \arrow["{i_{M \otimes N}}", from=1-1, to=1-2]
        \arrow["h", from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    So
    \[ \sum f(m_i, n_i) = \sum h(i_{M \otimes N}(m_i, n_i)) = h\qty(\sum i_{M \otimes N} (m_i, n_i)) = h(0) = 0 \]
    In the other direction, suppose \( \sum m_i \otimes n_i \neq 0 \).
    Then, taking \( f = i_{M \otimes N} \), we obtain \( \sum i_{M \otimes N}(m_i, n_i) \neq 0 \) as required.
\end{proof}
\begin{example}
    Let \( k \) be a field, and consider \( k^m \otimes k^\ell \).
    Let \( k^m \) have basis \( \qty{e_1, \dots, e_m} \) and \( k^\ell \) have basis \( f_1, \dots, f_\ell \).
    Then
    \[ k^m \otimes k^\ell = \vecspan_k \qty{v \otimes w \mid v \in k^m, w \in k^\ell} = \vecspan_k \qty{e_i \otimes f_j} \]
    This is in fact a basis.
    Suppose \( \sum_{i,j} \alpha_{i,j} e_i \otimes f_j = 0 \).
    For each \( a \leq m, b \leq \ell \), define \( T_{a,b} : k^m \times k^\ell \to k \) by
    \[ T_{a,b}\qty((v_i)_{i=1}^k, (w_j)_{j=1}^\ell) = v_a w_b \]
    By the above proposition,
    \[ 0 = \sum_{i,j} \alpha_{i,j} T_{a,b}(e_i, f_j) = \alpha_{a,b} \]
    So \( k^m \otimes k^\ell \simeq k^{m\ell} \).
    Note that this construction only relied on the existence of a free basis, not on \( k \) being a field.
\end{example}
\begin{example}
    Consider \( \mathbb R^2 \otimes_{\mathbb R} \mathbb R^2 \).
    There are infinitely many pure tensors, but there is a basis consisting of the four pure vectors
    \[ e_1 \otimes f_1;\quad e_1 \otimes f_2;\quad e_2 \otimes f_1;\quad e_2 \otimes f_2 \]
    A pure tensor in \( \mathbb R^2 \otimes_{\mathbb R} \mathbb R^2 \) is of the form
    \[ (\alpha e_1 + \beta e_2) \otimes (\gamma f_1 + \delta f_2) \]
    which expands to
    \[ (\alpha\gamma)(e_1 \otimes f_1) + (\alpha\delta)(e_1 \otimes f_2) + (\beta\gamma)(e_2 \otimes f_1) + (\beta\delta)(e_2 \otimes f_2) \]
    Note that there is a linear dependence relation between the coefficients \( \alpha\gamma, \alpha\delta, \beta\gamma, \beta\delta \), so in some sense `most' tensors are not pure.
    For example,
    \[ 1(e_1 \otimes f_1) + 2(e_1 \otimes f_2) + 3(e_2 \otimes f_1) + 4(e_2 \otimes f_2) \]
    is not pure.
\end{example}
\begin{example}
    Consider \( \mathbb Z \otimes_{\mathbb Z} \faktor{\mathbb Z}{2\mathbb Z} \).
    In this module,
    \[ 2 \otimes (1 + 2\mathbb Z) = 1 \otimes (2 + 2\mathbb Z) = 1 \otimes 0 = 0 \]
    Note that \( \mathbb Z \) has a \( \mathbb Z \)-submodule \( 2\mathbb Z \).
    In \( 2\mathbb Z \otimes_{\mathbb Z} \faktor{\mathbb Z}{2\mathbb Z} \), the element also denoted with \( 2 \otimes (1 + 2\mathbb Z) \) is nonzero.
    For example, we can define a bilinear map to \( \faktor{\mathbb Z}{2\mathbb Z} \) given by
    \[ b(2n, x + 2\mathbb Z) = n x + 2\mathbb Z \]
    Then \( b(2, 1 + 2\mathbb Z) = 1 \neq 0 \).
    So it is not the case that tensor products of submodules are submodules of tensor products.

    However, if \( M' \subseteq M \) and \( N' \subseteq N \) and \( \sum m_i \otimes n_i = 0 \) in \( M' \otimes N' \), then \( \sum m_i \otimes n_i = 0 \) in \( M \otimes N \).
\end{example}
\begin{proposition}
    If \( \sum m_i \otimes n_i = 0 \) in \( M \otimes_R N \), then there are finitely generated \( R \)-submodules \( M' \subseteq M \) and \( N' \subseteq N \) such that the expression \( \sum m_i \otimes n_i \) also evaluates to zero in \( M' \otimes_R N' \).
\end{proposition}
This is the last proof that will use the direct construction of the tensor product instead of the universal property directly.
\begin{proof}
    We know that \( \sum m_i \otimes n_i = 0 \) in \( M \otimes_R N = \faktor{R^{\oplus(M \times N)}}{K} \), so in particular \( \sum e_{(m_i, n_i)} \in K \), where \( e_x \) maps \( x \in M \times N \) to its basis element in \( R^{\oplus(M \times N)} \).
    So this is a finite sum of \( \alpha_i k_i \) with \( \alpha_i \in R, k_i \in K \), and so we can take the \( m_1', \dots, m_a' \) that appear on the left-hand sides of the \( k_i \) as the generators for \( M' \), and similarly for \( N' \).
\end{proof}
\begin{corollary}
    Let \( A, B \) be torsion-free abelian groups.
    Then \( A \otimes_{\mathbb Z} B \) is torsion-free.
\end{corollary}
\begin{proof}
    Suppose \( n \qty(\sum a_i \otimes b_i) = 0 \) with \( n \geq 1 \).
    By the previous proposition, there are finitely generated subgroups \( A' \leq A \) and \( B' \leq B \) such that \( n \qty(\sum a_i \otimes b_i) = 0 \) in \( A' \otimes_{\mathbb Z} B' \).
    But as \( A' \) and \( B' \) are finitely generated abelian groups, the structure theorem shows that \( A' = \mathbb Z^m \) and \( B' = \mathbb Z^\ell \), showing that \( A' \otimes_{\mathbb Z} B' \simeq \mathbb Z^{m\ell} \) is torsion-free.
    Thus \( \sum a_i \otimes b_i = 0 \) in \( A' \otimes_{\mathbb Z} B' \), so also \( \sum a_i \otimes b_i = 0 \) in \( A \otimes_{\mathbb Z} B \).
\end{proof}
\begin{example}
    \[ \mathbb C^2 \otimes_{\mathbb C} \mathbb C^3 \simeq \mathbb C^6 \simeq \mathbb R^{12} \]
    However,
    \[ \mathbb C^2 \otimes_{\mathbb R} \mathbb C^3 \simeq \mathbb R^4 \otimes_{\mathbb R} \mathbb R^6 \simeq \mathbb R^{24} \]
    This is to be expected: tensoring over a larger ring introduces more relations, so the amount of distinguishable elements should shrink.
\end{example}

\subsection{Monoidal structure}
\begin{proposition}[commutativity]
    There is an isomorphism \( M \otimes N \simeq N \otimes N \) mapping a pure tensor \( m \otimes n \) to \( n \otimes m \).
\end{proposition}
\begin{proof}
    Define \( f : M \times N \to N \otimes M \) by \( f(m, n) = n \otimes m \); this is bilinear.
    The universal property yields
    \[\begin{tikzcd}
        {M \times N} & {M \otimes N} \\
        & {N \otimes M}
        \arrow["{i_{M \otimes N}}", from=1-1, to=1-2]
        \arrow["h", from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    such that \( h(m \otimes n) = n \otimes m \).
    Similarly, we obtain \( h' : N \otimes M \to M \otimes N \) with \( h'(n \otimes m) = m \otimes n \).
    Hence, the following diagram commutes.
    \[\begin{tikzcd}
        {M \times N} & {M \otimes N} \\
        & {M \otimes N}
        \arrow["{i_{M \otimes N}}", from=1-1, to=1-2]
        \arrow["{h' \circ h}", shift left=2, from=1-2, to=2-2]
        \arrow["\id"', shift right=2, from=1-2, to=2-2]
        \arrow["{i_{M \otimes N}}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    So by the uniqueness condition in the universal property, \( h' \circ h \) is the identity.
    Similarly, \( h \circ h' \) is the identity, thus \( h \) is an isomorphism.
\end{proof}
\begin{proposition}[associativity]
    There is an isomorphism \( (M \otimes N) \otimes P \simeq M \otimes (N \otimes P) \) mapping \( (m \otimes n) \otimes p \) to \( m \otimes (n \otimes p) \).
\end{proposition}
\begin{proof}
    % Let \( \mathcal F = R^{\oplus(M \times N \times P)} \) be the free \( R \)-module with coordinates indexed by \( M \times N \times P \).
    % Define \( K \subseteq \mathcal F \) to be the submodule generated by the following set of relations:
    % \begin{align*}
    %     &(m_1 + m_2, n, p) - (m_1, n, p) - (m_2, n, p) \\
    %     &(m, n_1 + n_2, p) - (m, n_1) - (m, n_2, p) \\
    %     &(m, n, p_1 + p_2) - (m, n, p_1) - (m, n, p_2) \\
    %     &r (m, n, p) - (rm, n, p) \\
    %     &r (m, n, p) - (m, rn, p) \\
    %     &r (m, n, p) - (m, n, rp)
    % \end{align*}
    % Then define \( M \otimes N \otimes P = \faktor{\mathcal F}{K} \).
    % We can now define the \( R \)-trilinear map
    % \[ i_{M \otimes N \otimes P} : M \times N \times P \to M \otimes N \otimes P;\quad i_{M \otimes N \otimes P}(m, n, p) = m \otimes n \otimes p \]
    % We can now state the universal property of this construction, namely, that for each \( R \)-trilinear map \( f : M \times N \times P \to L \), there is a unique \( R \)-module homomorphism making the following diagram commute.
    % \[\begin{tikzcd}[column sep=large]
    %     {M \times N \times P} & {M \otimes N \otimes P} \\
    %     & L
    %     \arrow["{i_{M \otimes N \otimes P}}", from=1-1, to=1-2]
    %     \arrow["h", dashed, from=1-2, to=2-2]
    %     \arrow["f"', from=1-1, to=2-2]
    % \end{tikzcd}\]
    % Define \( f : M \times N \times P \to (M \otimes N) \otimes P \) by \( f(m, n, p) = (m \otimes n) \otimes p \); this is clearly trilinear.
    % Thus it factors through \( h : M \otimes N \otimes P \to (M \otimes N) \otimes P \).
    For each \( p \in P \), define the bilinear map \( f_p : M \times N \to M \otimes (N \otimes P) \) by
    \[ f_p(m, n) = m \otimes (n \otimes p) \]
    Thus, each \( f_p \) factors through \( h_p : M \otimes N \to M \otimes (N \otimes P) \).
    Then, define the bilinear map \( f : (M \otimes N) \times P \to M \otimes (N \otimes P) \) by
    \[ f(x, p) = h_p(x) \]
    We show this is bilinear in \( p \).
    Note that
    \begin{align*}
        h_{p_1 + p_2}(m \otimes n) &= f_{p_1 + p_2}(m, n) \\
        &= m \otimes (n \otimes (p_1 + p_2)) \\
        &= m \otimes (n \otimes p_1) + m \otimes (n \otimes p_2) \\
        &= f_{p_1}(m, n) + f_{p_2}(m, n) \\
        &= h_{p_1}(m \otimes n) + h_{p_2}(m \otimes n)
    \end{align*}
    So \( h_{p_1 + p_2} \) coincides with \( h_{p_1} + h_{p_2} \) on the pure tensors, so by the universal property they coincide everywhere.
    Similarly,
    \begin{align*}
        h_{rp}(m \otimes n) &= f_{rp}(m, n) \\
        &= m \otimes (n \otimes rp) \\
        &= r (m \otimes (n \otimes p)) \\
        &= r f_p(m, n) \\
        &= r h_p(m \otimes n)
    \end{align*}
    so \( h_{rp} = rh_p \).
    Then, by the universal property, \( f \) factors through \( h : (M \otimes N) \otimes P \to M \otimes (N \otimes P) \), so
    \[ h((m \otimes n) \otimes p) = m \otimes (n \otimes p) \]
    We can similarly construct \( h' : M \otimes (N \otimes P) \to (M \otimes N) \otimes P \) with
    \[ h'(m \otimes (n \otimes p)) = (m \otimes n) \otimes p \]
    Since \( h \circ h' \) and \( h' \circ h \) are the identity on pure vectors, they are the identity everywhere, and hence are inverse isomorphisms.
\end{proof}
\begin{proposition}[identity]
    There is an isomorphism \( R \otimes M \simeq M \) mapping \( r \otimes m \) to \( rm \).
\end{proposition}
\begin{proof}
    The map \( f : R \times M \to M \) given by \( f(r, m) = rm \) factors through some \( h : R \otimes M \to M \).
    \[\begin{tikzcd}
        {R \times M} & {R \otimes M} \\
        & M
        \arrow["{i_{R \otimes M}}", from=1-1, to=1-2]
        \arrow["h", dashed, from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    Now define the \( R \)-module homomorphism \( h' : M \to R \otimes M \) by \( h'(m) = 1 \otimes m = i_{R \otimes M}(1, m) \).
    Then
    \[ (h \circ h')(m) = h(i_{R \otimes M}(1, m)) = f(1, m) = m \]
    giving \( h \circ h' = \id \).
    Further,
    \[ (h' \circ h)(r \otimes m) = 1 \otimes h(r \otimes m) = 1 \otimes f(r, m) = 1 \otimes rm = r \otimes m \]
    So by the uniqueness condition in the universal property, \( h' \circ h \) is the identity, and hence \( h \) is an isomorphism.
\end{proof}
These operations, together with coherence conditions, make the category of \( R \)-modules into a \emph{braided monoidal category}, where the monoid operation is \( \otimes \) and the unit is \( R \).
\begin{proposition}[distributivity]
    There is an isomorphism \( \qty(\bigoplus_i M_i) \otimes P \simeq \bigoplus_i (M_i \otimes P) \) mapping \( (m_i)_i \otimes p \) to \( (m_i \otimes p)_i \).
\end{proposition}
\begin{proof}
    Define \( f \) by
    \[ f((m_i)_i, p) = (m_i \otimes p)_i \]
    Then there is a unique \( h \) such that the following diagram commutes.
    \[\begin{tikzcd}
        {\qty(\bigoplus_i M_i) \times P} & {\qty(\bigoplus_i M_i) \otimes P} \\
        & {\bigoplus_i (M_i \otimes P)}
        \arrow["{i_{\qty(\bigoplus_i M_i) \otimes P}}", from=1-1, to=1-2]
        \arrow["h", dashed, from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    For each \( i \), define the map \( f_i' : M_i \times P \to \qty(\bigoplus_i M_i) \otimes P \) by
    \[ f_i'(m_i, p) = m_i \otimes p \]
    By the universal property of the tensor product, this factors through a unique \( h_i' \).
    \[\begin{tikzcd}
        {M_i \times P} & {M_i \otimes P} \\
        & {\qty(\bigoplus_i M_i) \otimes P}
        \arrow["{i_{M_i \otimes P}}", from=1-1, to=1-2]
        \arrow["{h_i'}", dashed, from=1-2, to=2-2]
        \arrow["{f_i'}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    Then, by the universal property of the direct sum, the \( h_i' \) can be combined into a single \( h' \), so this diagram commutes for each \( i \).
    \[\begin{tikzcd}
        {M_i \otimes P} & {\bigoplus_i \qty(M_i \otimes P)} \\
        & {\qty(\bigoplus_i M_i) \otimes P}
        \arrow[from=1-1, to=1-2]
        \arrow["{h'}", dashed, from=1-2, to=2-2]
        \arrow["{h_i'}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    It remains to show that \( h \) and \( h' \) are inverses.
    To show \( h \circ h' = \id_{\bigoplus_i \qty(M_i \otimes P)} \), it suffices by the universal property of the direct sum to show that \( (h \circ h')(x) = x \) for all \( x \in M_i \otimes P \), for each \( i \).
    Then, by the universal property of the tensor product, it further suffices to show this result only for pure tensors.
    \begin{align*}
        (h \circ h')(m_i \otimes p) &= h(h'(m_i \otimes p)) \\
        &= h(h'_i(m_i \otimes p)) \\
        &= h(f_i'(m_i, p)) \\
        &= h(m_i \otimes p) \\
        &= f(m_i, p) \\
        &= m_i \otimes p
    \end{align*}
    To show \( h' \circ h = \id_{\qty(\bigoplus_i M_i) \otimes P} \), it suffices by the universal property of the tensor product to show that \( (h' \circ h)((m_i)_i \otimes p) = (m_i)_i \otimes p \).
    By linearity of \( h \) and \( h' \), we can reduce to the case where \( (m_i)_i \) has a single non-zero element \( m_i \).
    \begin{align*}
        (h' \circ h)(m_i \otimes p) &= h'(h(m_i \otimes p)) \\
        &= h'(f(m_i, p)) \\
        &= h'(m_i \otimes p) \\
        &= h'_i(m_i \otimes p) \\
        &= f'_i(m_i \otimes p) \\
        &= f'_i(m_i, p) \\
        &= m_i \otimes p
    \end{align*}
\end{proof}
\begin{example}
    \[ R^m \otimes_R R^\ell = \qty(\bigoplus_{i=1}^m R) \otimes_R \qty(\bigoplus_{j=1}^\ell R) \simeq \bigoplus_{i=1}^m \bigoplus_{j=1}^\ell (R \otimes R) \simeq \bigoplus_{i=1}^m \bigoplus_{j=1}^\ell R \simeq R^{m\ell} \]
\end{example}
\begin{proposition}[quotients]
    Let \( M' \subseteq M \) and \( N' \subseteq N \) be \( R \)-modules.
    Then there is an isomorphism
    \[ \faktor{M}{M'} \otimes \faktor{N}{N'} \simeq \faktor{(M \otimes N)}{L} \]
    where \( L \) is the submodule of \( M \otimes N \) generated by
    \[ \qty{m' \otimes n \mid (m', n) \in M' \times N} \cup \qty{m \otimes n' \mid (m, n') \in M \times N'} \]
    and mapping
    \[ (m + M') \otimes (n + N') \mapsto m \otimes n + L \]
\end{proposition}
\begin{proof}
    Define
    \[ f : \faktor{M}{M'} \times \faktor{N}{N'} \to \faktor{(M \otimes N)}{L} \]
    by
    \[ f(m + M', n + N') = m \otimes n + L \]
    This is well-defined: if \( m \in M' \) or \( n \in N' \), then \( m \otimes n \in L \).
    By the universal property of the tensor product, \( f \) factors through some \( h \).
    \[\begin{tikzcd}[column sep=huge]
        {\faktor{M}{M'} \times \faktor{N}{N'}} & {\faktor{M}{M'} \otimes \faktor{N}{N'}} \\
        & {\faktor{(M \otimes N)}{L}}
        \arrow["{i_{\faktor{M}{M'} \otimes \faktor{N}{N'}}}", from=1-1, to=1-2]
        \arrow["h", dashed, from=1-2, to=2-2]
        \arrow["f"', from=1-1, to=2-2]
    \end{tikzcd}\]
    Now define
    \[ f' : M \times N \to \faktor{M}{M'} \otimes \faktor{N}{N'} \]
    by
    \[ f'(m, n) = (m + M') \otimes (n + N') \]
    This is clearly bilinear.
    Thus, we have
    \[\begin{tikzcd}
        {M \times N} & {M \otimes N} \\
        & {\faktor{M}{M'} \otimes \faktor{N}{N'}}
        \arrow["{i_{M \otimes N}}", from=1-1, to=1-2]
        \arrow["{h'}", dashed, from=1-2, to=2-2]
        \arrow["{f'}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    We show that if \( x \in L \), then \( h'(x) = 0 \).
    By linearity it suffices to show this for the generators.
    \[ h'(m' \otimes n) = f'(m', n) = 0 \otimes (n + N') = 0;\quad h'(m \otimes n') = f'(m, n') = (m + M') \otimes 0 = 0 \]
    Thus \( h' \) factors through the quotient.
    \[\begin{tikzcd}
        {M \otimes N} & {\faktor{(M \otimes N)}{L}} \\
        & {\faktor{M}{M'} \otimes \faktor{N}{N'}}
        \arrow["\pi", from=1-1, to=1-2]
        \arrow["{h''}", dashed, from=1-2, to=2-2]
        \arrow["{h'}"', from=1-1, to=2-2]
    \end{tikzcd}\]
    We show \( h \) and \( h'' \) are inverses.
    To show \( h \circ h'' = \id_{\faktor{(M \otimes N)}{L}} \), it suffices by the universal properties of the quotient and the tensor product to consider the images of pure tensors under the quotient map \( \pi \).
    \begin{align*}
        (h \circ h'')(m \otimes n + L) &= h(h''(\pi(m \otimes n))) \\
        &= h(h'(m \otimes n)) \\
        &= h(f'(m, n)) \\
        &= h((m + M') \otimes (n + N')) \\
        &= f(m + M', n + N') \\
        &= m \otimes n + L
    \end{align*}
    To show \( h'' \circ h = \id_{\faktor{M}{M'} \otimes \faktor{N}{N'}} \), it suffices to show the result for expressions of the form \( (m + M') \otimes (n + N') \).
    \begin{align*}
        (h'' \circ h)((m + M') \otimes (n + N')) &= h''(h((m + M') \otimes (n + N'))) \\
        &= h''(f(m + M', n + N')) \\
        &= h''(m \otimes n + L) \\
        &= h'(m \otimes n) \\
        &= f'(m + M', n + N') \\
        &= (m + M') \otimes (n + N')
    \end{align*}
\end{proof}

\subsection{Tensor products of maps}
\begin{proposition}
    Let \( f : M \to M' \) and \( g : N \to N' \) be \( R \)-module homomorphisms.
    There is a unique \( R \)-module homomorphism \( f \otimes g : M \otimes N \to M' \otimes N' \) such that
    \[ (f \otimes g)(m \otimes n) = f(m) \otimes g(n) \]
\end{proposition}
\begin{proof}
    We apply the universal property to the map \( T : M \times N \to M \otimes N' \) given by
    \[ T(m, n) = f(m) \otimes g(n) \]
    which can be checked to be \( R \)-bilinear.
\end{proof}
\begin{example}
    We can show
    \[ (f \otimes g) \circ (h \otimes i) = (f \circ h) \otimes (g \circ i) \]
    For example, if \( T : k^a \to k^b \) and \( S : k^c \to k^d \),
    \[ T \otimes S : k^a \otimes_k k^c \to k^b \otimes_k k^d \]
    is given by
    \[ (T \otimes S)(e_i \otimes e_j) = (T e_i) \otimes (S e_j) = \sum_{\ell, t} [T]_{\ell i} [S]_{t j} (f_\ell \otimes f_t) \]
    where \( [T] \) denotes \( T \) in the standard basis.
    Ordering the basis elements of \( k^a \otimes k^c \) as
    \[ e_1 \otimes e_1, \dots, e_1 \otimes e_c, e_2, \otimes e_1, \dots, e_a \otimes e_c \]
    and similarly for \( k^b \otimes k^d \),
    \[ [T \otimes S] = \begin{pmatrix}
        [T]_{11} \cdot [S] & \cdots & [T]_{1a} \cdot [S] \\
        \vdots & \ddots & \vdots \\
        [T]_{b1} \cdot [S] & \cdots & [T]_{ba} \cdot [S]
    \end{pmatrix} \]
    This is known as the \emph{Kronecker product} of matrices.
\end{example}
\begin{proposition}
    Let \( f : M \to M', g : N \to N' \) be \( R \)-module homomorphisms.
    Then,
    \begin{enumerate}
        \item if \( f, g \) are isomorphisms, then so is \( f \otimes g \);
        \item if \( f, g \) are surjective, then so is \( f \otimes g \).
    \end{enumerate}
\end{proposition}
\begin{proof}
    \emph{Part (i).}
    \( f^{-1} \otimes g^{-1} \) is a two-sided inverse for \( f \otimes g \), as
    \[ (f^{-1} \otimes g^{-1}) \circ (f \otimes g) = (f^{-1} \circ f) \otimes (g^{-1} \otimes g) = \id \]
    and similarly for the other side.

    \emph{Part (ii).}
    The image of \( f \otimes g \) contains all pure tensors of \( M' \otimes N' \), so it must be surjective.
\end{proof}
The analogous result for injectivity does not hold in the general case.
Consider \( f : \mathbb Z \to \mathbb Z \) given by multiplication by \( p \), and \( g : \faktor{\mathbb Z}{p\mathbb Z} \to \faktor{\mathbb Z}{p\mathbb Z} \) given by the identity.
Here,
\[ (f \otimes g)(a \otimes b) = (pa) \otimes b = a \otimes (pb) = a \otimes 0 = 0 \]
So \( f \otimes g \) is the zero map, but \( \mathbb Z \otimes \faktor{\mathbb Z}{p\mathbb Z} \simeq \faktor{\mathbb Z}{p\mathbb Z} \) is not the zero ring.

\subsection{Tensor products of algebras}
Let \( B, C \) be \( R \)-algebras.
The usual tensor product of modules \( B \otimes_R C \) can be made into a ring and then an \( R \)-algebra.
This allows us to define the tensor product of algebras in a natural way.
We want the ring structure to satisfy
\[ (b \otimes c)(b' \otimes c') = (bb') \otimes (cc') \]
This extends to a well-defined map on all of \( B \otimes C \).
Indeed, for a fixed \( (b, c) \in B \times C \), there is an \( R \)-bilinear map \( B \times C \to B \otimes C \) given by
\[ (b', c') \mapsto (bb') \otimes (cc') \]
so we can use the universal property to extend this to a map \( B \otimes C \to B \otimes C \) that acts on pure tensors in the obvious way.
% TODO: why done here? check linearity in b and c?
One can show that the ring axioms are satisfied.
To define the \( R \)-algebra structure, we define the ring homomorphism \( R \to B \otimes C \) by
\[ r \mapsto (r \cdot 1_B) \otimes 1_C = 1_B \otimes (r \cdot 1_C) \]
\begin{example}
    There is an isomorphism of \( R \)-algebras
    \[ \varphi : R[X_1, \dots, X_n] \otimes_R R[T_1, \dots, T_r] \similarrightarrow R[X_1, \dots, X_n, T_1, \dots, T_r] \]
    An \( R \)-basis for the left-hand side as an \( R \)-module is given by elements of the form \( a \otimes b \) where \( a \) and \( b \) are monomials.
    The right hand side has a basis of elements of the form \( ab \), where \( a \in R[X_1, \dots, X_n] \) and \( b \in R[T_1, \dots, T_r] \) are monomials as above.
    Mapping \( \varphi(a \otimes b) = ab \), we obtain an \( R \)-module isomorphism.
    To check this is an \( R \)-algebra isomorphism, we verify multiplication and its action on scalars.
    \[ \varphi(r \otimes 1) = r \cdot 1;\quad \varphi(1 \otimes 1) \]
    and for monomials \( p_i, q_i, h_i, g_i \),
    \begin{align*}
        \varphi\qty(\qty(\sum_i p_i \otimes q_i)\qty(\sum_j h_j \otimes g_j)) &= \sum_{i,j} (p_i h_j) (q_i g_j) \\
        &= \sum_{i,j} (p_i q_i)(h_j g_j) \\
        &= \sum_{i,j} \varphi(p_i \otimes q_i) \varphi(h_j \otimes g_j) \\
        &= \qty(\sum_i \varphi(p_i \otimes q_i))\qty(\sum_j \varphi(h_j g_j)) \\
        &= \varphi\qty(\sum_i p_i \otimes q_i) \varphi\qty(\sum_j h_j \otimes g_j)
    \end{align*}
    More generally,
    \[ \faktor{R[X_1, \dots, X_n]}{I} \otimes \faktor{R[T_1, \dots, T_r]}{J} \simeq \faktor{R[X_1, \dots, X_n] \otimes R[T_1, \dots, T_r]}{L} \simeq \faktor{R[X_1, \dots, X_n, T_1, \dots, T_r]}{I^e + J^e} \]
    where \( L \) is constructed as above when quotients were discussed, and \( I^e \) is the extension of \( I \) in the larger ring \( R[X_1, \dots, X_n, T_1, \dots, T_r] \).
    For example,
    \[ \faktor{\mathbb C[X, Y, Z]}{(f, g)} \otimes_{\mathbb C} \faktor{\mathbb C[W, U]}{(h)} \simeq \faktor{\mathbb C[X, Y, Z, W, U]}{(f, g, h)} \]
\end{example}
\begin{proposition}[universal property of tensor product of algebras]
    Let \( A, B \) be \( R \)-algebras.
    For every algebra \( C \) and \( R \)-algebra homomorphisms \( f_1 : A \to C \) and \( f_2 : B \to C \), there is a unique \( R \)-algebra homomorphism \( h : A \otimes_R B \to C \) such that the following diagram commutes:
    \[\begin{tikzcd}
        A && B \\
        & {A \otimes B} \\
        & C
        \arrow["{i_A}", from=1-1, to=2-2]
        \arrow["{i_B}"', from=1-3, to=2-2]
        \arrow["{f_1}"', curve={height=12pt}, from=1-1, to=3-2]
        \arrow["{f_2}", curve={height=-12pt}, from=1-3, to=3-2]
        \arrow["h", dashed, from=2-2, to=3-2]
    \end{tikzcd}\]
    where \( i_A(a) = a \otimes 1 \) and \( i_B(b) = 1 \otimes b \).
    Furthermore, this characterises the triple \( (A \otimes_R B, i_A, i_B) \) uniquely up to unique isomorphism.
\end{proposition}
\begin{proof}
    \( A \otimes_R B \) is generated as an \( R \)-algebra by \( \qty{a \otimes 1 \mid a \in A} \cup \qty{1 \otimes b \mid b \in B} \).
    This implies the uniqueness of \( h \).
    For existence, we can define an \( R \)-bilinear map \( A \times B \to C \) by \( (a, b) \mapsto f_1(a) f_2(b) \), then apply the universal property of the tensor product of modules.
    This produces an \( R \)-linear map \( h : A \otimes B \to C \).
    It remains to show that this is a homomorphism of algebras.
    % the computation above with sums and \varphi is a special case of the following computation
\end{proof}
\begin{example}
    \[\begin{tikzcd}
        {R[X_1, \dots, X_n]} && {R[T_1, \dots, T_r]} \\
        & {R[X_1, \dots, X_n, T_1, \dots, T_r]} \\
        & C
        \arrow[from=1-1, to=2-2]
        \arrow[from=1-3, to=2-2]
        \arrow[from=2-2, to=3-2]
        \arrow["{f_1}"', curve={height=12pt}, from=1-1, to=3-2]
        \arrow["{f_2}", curve={height=-12pt}, from=1-3, to=3-2]
    \end{tikzcd}\]
    An algebra homomorphism from a polynomial ring is defined uniquely by giving its action on its variables, thus
    \[ R[X_1, \dots, X_n] \otimes R[T_1, \dots, T_r] \simeq R[X_1, \dots, X_n, T_1, \dots, T_r] \]
    as was shown above.
\end{example}
\begin{remark}
    \begin{enumerate}
        \item If \( f : A \to A', g : B \to B' \) are \( R \)-algebra homomorphisms, then \( f \otimes g : A \otimes B \to A' \otimes B' \) is not only an \( R \)-module homomorphism but is also an \( R \)-algebra homomorphism.
        \item There are \( R \)-algebra homomorphisms
        \begin{enumerate}
            \item \( \faktor{R}{I} \otimes \faktor{R}{J} \simeq \faktor{R}{I+J} \);
            \item \( A \otimes B \simeq B \otimes A \);
            \item \( A \otimes (B \times C) \simeq (A \otimes B) \times (A \otimes C) \);
            \item \( A \otimes B^n \simeq (A \otimes B)^n \);
            \item \( (A \otimes B) \otimes C \simeq A \otimes (B \otimes C) \).
        \end{enumerate}
    \end{enumerate}
\end{remark}

\subsection{Restriction and extension of scalars}
Let \( f : R \to S \) be a ring homomorphism.
Let \( M \) be an \( S \)-module.
Then we can \emph{restrict scalars} to make \( M \) into an \( R \)-module by
\[ r \cdot m = f(r) \cdot m \]
The composition \( R \to S \to \End M \) is a ring homomorphism, so this makes \( M \) into an \( R \)-module automatically without needing to check axioms.
\begin{example}
    Let \( f : \mathbb R \to \mathbb C \) be the inclusion.
    Then any \( \mathbb C \)-module is an \( \mathbb R \)-module.
\end{example}

Now suppose \( f : R \to S \) is a ring homomorphism, \( M \) is an \( S \)-module, and \( N \) is an \( R \)-module.
We can form the \( R \)-module \( M \otimes_R N \), as \( M \) is an \( R \)-module by restriction of scalars.
\emph{Extension of scalars} shows that \( M \otimes_R N \) is also an \( S \)-module.
The action of \( s \in S \) on pure tensors is
\[ s \cdot (m \otimes n) = sm \otimes n \]
We have an \( R \)-bilinear map \( M \times N \to M \otimes_R N \) by
\[ (m, n) \mapsto sm \otimes n \]
so by the universal property this gives rise to a map \( h_s : M \otimes_R N \to M \otimes_R N \) with the desired action on pure tensors.
\( h_s \) is \( R \)-linear by the universal property.
Defining \( \varphi : S \to \End(M \otimes_R N) \) by \( \varphi(s) = h_s \), one can check that \( h_s \) is a well-defined endomorphism and that \( \varphi \) is a ring homomorphism.
\begin{example}
    \( S \otimes_R R \simeq R \) as \( R \)-modules, by \( s \otimes r \mapsto s \cdot f(r) \).
    This is also \( S \)-linear, since
    \[ s'(s \otimes r) = (s's \otimes r) \mapsto s's \cdot f(r) = s'(s \cdot f(r)) \]
    For example, \( \mathbb C \otimes_{\mathbb R} \mathbb R \simeq \mathbb C \) as \( \mathbb C \)-modules.
\end{example}
\begin{example}
    Let \( M \) be an \( S \)-module and \( (N_i)_{i \in I} \) are \( R \)-modules.
    Then
    \[ M \otimes \qty(\bigoplus_i N_i) \simeq \bigoplus_i (M \otimes N_i) \]
    as \( S \)-modules.
    So \( \mathbb C \otimes_{\mathbb R} \mathbb R^n \simeq \mathbb C^n \) as \( \mathbb C \)-modules.
\end{example}
\begin{example}
    Restrict the \( \mathbb C \)-module \( \mathbb C^n \) to an \( \mathbb R \)-module to obtain \( \mathbb R^{2n} \).
    Then, extending to \( \mathbb C \),
    \[ \mathbb C \otimes_{\mathbb R} \mathbb R^{2n} \simeq \mathbb C^{2n} \]
    Similarly, extending \( \mathbb R^n \) to \( \mathbb C \), we find \( \mathbb C \otimes_{\mathbb R} \mathbb R^n \simeq \mathbb C^n \) over \( \mathbb C \).
    Restricting to \( \mathbb R \), \( \mathbb C^n \simeq \mathbb R^{2n} \).
    So the operations of restriction and extension of scalars are not inverses in either direction.
\end{example}
\begin{example}
    Consider \( \mathbb Z^n \) as a \( \mathbb Z \)-module.
    Consider the quotient map \( f : \mathbb Z \to \faktor{\mathbb Z}{2\mathbb Z} \).
    Extending scalars to \( \faktor{\mathbb Z}{2\mathbb Z} \),
    \[ \faktor{\mathbb Z}{2\mathbb Z} \otimes_{\mathbb Z} \mathbb Z^n \simeq \qty(\faktor{\mathbb Z}{2\mathbb Z})^n \]
\end{example}
\begin{example}
    Consider \( \mathbb C^n \otimes_{\mathbb R} \mathbb R^\ell \) as a \( \mathbb C \)-module.
    As \( \mathbb R \)-modules,
    \[ \mathbb C^n \otimes_{\mathbb R} \mathbb R^\ell \simeq \mathbb R^{2n} \otimes_{\mathbb R} \mathbb R^\ell \simeq \mathbb R^{2n\ell} \simeq \mathbb C^{n\ell} \]
    We would like to make this into an isomorphism of \( \mathbb C \)-modules.
    We will show that in fact
    \[ \mathbb C^n \otimes_{\mathbb R} \mathbb R^\ell \simeq \mathbb C^n \otimes_{\mathbb C} (\mathbb C \otimes_{\mathbb R} \mathbb R^\ell) \]
    where
    \[ v \otimes u \mapsto v \otimes (1 \otimes u) \]
    giving
    \[ \mathbb C^n \otimes_{\mathbb R} \mathbb R^\ell \simeq \mathbb C^n \otimes_{\mathbb C} \mathbb C^\ell \simeq \mathbb C^{n\ell} \]
    as \( \mathbb C \)-modules.
    The isomorphism
    \[ \mathbb C^n \otimes_{\mathbb R} \mathbb R^\ell \simeq \mathbb C^n \otimes_{\mathbb C} \mathbb C^\ell \]
    maps a pure tensor \( v \otimes u \) to \( v \otimes u \).
\end{example}
\begin{proposition}
    Let \( M \) be an \( S \)-module and \( N \) be an \( R \)-module.
    Then
    \[ M \otimes_R N \simeq M \otimes_S (S \otimes_R N) \]
    as \( S \)-modules, where
    \[ m \otimes n \mapsto m \otimes (1 \otimes n);\quad sm \otimes n \mapsfrom m \otimes (s \otimes n) \]
\end{proposition}
\begin{proof}
    The map \( (m, n) \mapsto m \otimes (1 \otimes n) \) is \( R \)-bilinear, so the map \( f \) mapping \( m \otimes n \) to \( m \otimes (1 \otimes n) \) is well-defined as a map of \( R \)-modules.
    We show it is \( S \)-linear on pure tensors.
    \[ f(s(m \otimes n)) = f(sm \otimes n) = sm \otimes (1 \otimes n) = s (m \otimes (1 \otimes n)) = s f(m \otimes n) \]
    For a fixed \( m \in M \), the map \( s \otimes n \mapsto sm \otimes n \) is well-defined and \( S \)-linear.
    This collection of maps is \( S \)-linear in its parameter \( m \), so we obtain an \( S \)-bilinear map \( (m, s \otimes n) \mapsto sm \otimes n \).
    Hence, we obtain a map \( g \) mapping \( m \otimes (s \otimes n) \) to \( sm \otimes n \), as desired.
    One can easily check that \( f \) and \( g \) are inverses on pure tensors.
\end{proof}
\begin{proposition}
    Let \( M, M' \) be \( S \)-modules and \( N, N' \) be \( R \)-modules.
    Then we have \( S \)-module isomorphisms
    \begin{align*}
        M \otimes_R N &\simeq N \otimes_R M \\
        (M \otimes_R N) \otimes_R N' &\simeq M \otimes_R (N \otimes_R N') \\
        (M \otimes_R N) \otimes_S M' &\simeq M \otimes_S (N \otimes_R M') \\
        M \otimes_R \qty(\bigoplus_i N_i) &\simeq \bigoplus_i (M \otimes_R N_i)
    \end{align*}
\end{proposition}
Heuristically, the tensor products in the above isomorphisms always operate over the largest possible ring: \( S \) if both operands are \( S \)-modules, else \( R \).
We prove only the third result.
\begin{proof}
    By the previous proposition,
    \begin{align*}
        (M \otimes_R N) \otimes_S M' &\simeq (M \otimes_S (N \otimes_R S)) \otimes_S M' \\
        &\simeq M \otimes_S ((N \otimes_R S) \otimes_S M') \\
        &\simeq M \otimes_S (N \otimes_R M')
    \end{align*}
\end{proof}
\begin{corollary}
    Let \( N, N' \) be \( R \)-modules.
    Then
    \[ S \otimes_R (N \otimes_R N') \simeq (S \otimes_R N) \otimes_S (S \otimes_R N') \]
    as \( S \)-modules.
\end{corollary}
\begin{proof}
    \[ S \otimes_R (N \otimes_R N') \simeq (S \otimes_R N) \otimes_R N' \simeq (S \otimes_R N) \otimes_S (S \otimes_R N') \]
\end{proof}
\begin{example}
    \[ \mathbb C \otimes_{\mathbb R} \qty(\mathbb R^\ell \otimes_{\mathbb R} \mathbb R^k) \simeq (\mathbb C \otimes_{\mathbb R} \mathbb R^\ell) \otimes_{\mathbb C} (\mathbb C \otimes_{\mathbb R} \mathbb R^k) \simeq \mathbb C^\ell \otimes_{\mathbb C} \mathbb C^k \simeq \mathbb C^{\ell k} \]
    By induction, one can see that
    \[ S \otimes_R (N_1 \otimes_R \dots \otimes_R N_\ell) = (S \otimes_R N_1) \otimes_S \dots \otimes_S (S \otimes_R N_\ell) \]
\end{example}

\subsection{Extension of scalars on morphisms}
Let \( f : N \to N' \) be an \( R \)-linear map, and \( M \) be an \( S \)-module.
Then the map
\[ \id_M \otimes f : M \otimes_R \to M \otimes_R N' \]
is \( S \)-linear.
Indeed,
\[ (\id_M \otimes f)(s(m \otimes n)) = \id_M sm \otimes f(n) = s(m \otimes f(n)) = s((\id_M \otimes f)(m \otimes n)) \]
\begin{example}
    Let \( T : \mathbb R^n \to \mathbb R^\ell \) be \( R \)-linear, and use bases \( e_1, \dots, e_n \) and \( f_1, \dots, f_\ell \).
    Then
    \[ \id_{\mathbb C} \otimes T : \mathbb C \otimes_{\mathbb R} \mathbb R^n \to \mathbb C \otimes_{\mathbb R} \mathbb R^\ell \]
    is given by
    \[ (\id_{\mathbb C} \otimes T)(1 \otimes e_i) = 1 \otimes T(e_i) = 1 \otimes \sum_{j=1}^\ell [T]_{ji} \cdot f_j = \sum_{j=1}^\ell [T]_{ji} (1 \otimes f_j) \]
    This shows that the matrix \( [\id_{\mathbb C} \otimes T] \) has all real elements, and is the same as the matrix \( [T] \).
\end{example}

\subsection{Extension of scalars in algebras}
Let \( A, B \) be \( R \)-algebras.
Then the module \( A \otimes_R B \) is also an \( R \)-algebra.
Furthermore, can see that \( A \otimes_R B \) is an \( A \)-algebra and a \( B \)-algebra by the maps \( a \mapsto a \otimes 1 \) and \( b \mapsto 1 \otimes b \).
\begin{example}
    Consider \( R[X_1, \dots, X_n] \) and \( f : R \to S \).
    Then
    \[ \varphi : S \otimes_R R[X_1, \dots, X_n] \similarrightarrow S[X_1, \dots, X_n] \]
    as \( S \)-algebras.
    Indeed, \( \varphi \) already exists as an isomorphism of \( S \)-modules given by
    \[ \varphi(s \otimes p) = sp \]
    and one can verify that unity and multiplication are preserved.
    Further,
    \[ S \otimes \qty(\faktor{R[X_1, \dots, X_n]}{I}) \simeq \faktor{S[X_1, \dots, X_n]}{I^e} \]
\end{example}
\begin{proposition}
    Let \( A \) be an \( R \)-algebra and \( B \) be an \( S \)-algebra.
    Then
    \[ A \otimes_R B \simeq (A \otimes_R S) \otimes_S R \]
    as \( S \)-algebras.
\end{proposition}
\begin{proposition}
    Let \( A, B \) be \( R \)-algebras.
    Then
    \[ S \otimes_R (A \otimes_R B) \simeq (S \otimes_R A) \otimes_S (S \otimes_R B) \]
    as \( S \)-algebras.
\end{proposition}
The proofs are omitted, but trivial.

\subsection{Exactness properties of the tensor product}
Let \( M \) be an \( R \)-module.
There is a functor
\[ T_M : \mathbf{Mod}_R \to \mathbf{Mod}_R \]
from the category of \( R \)-modules to itself given by
\[ T_M(N) = M \otimes_R N;\quad T_M(N \xrightarrow f N') = \id_M \otimes f \]
We intend to show that if
\[\begin{tikzcd}
	A & B & C & 0
	\arrow["f", from=1-1, to=1-2]
	\arrow["g", from=1-2, to=1-3]
	\arrow[from=1-3, to=1-4]
\end{tikzcd}\]
is an exact sequence of \( R \)-modules, then
\[\begin{tikzcd}
	{M \otimes_R A} & {M \otimes_R B} & {M \otimes_R C} & 0
	\arrow["{T_M(f)}", from=1-1, to=1-2]
	\arrow["{T_M(g)}", from=1-2, to=1-3]
	\arrow[from=1-3, to=1-4]
\end{tikzcd}\]
is also an exact sequence.
This shows that \( T_M \) is a \emph{right exact} functor.
\begin{definition}
    Let \( Q, P \) be \( R \)-modules.
    Then
    \[ \Hom_R(Q, P) = \qty{f : Q \to P \mid f \text{ is } R\text{-linear}} \]
    This is also an \( R \)-module: if \( \varphi \in \Hom_R(Q, P) \),
    \[ (r \cdot \varphi)(q) = r \cdot \varphi(q) \]
\end{definition}
\begin{definition}
    Let \( Q, P \) be \( R \)-modules.
    Then
    \[ \Hom_R(Q, -) : \mathbf{Mod}_R \to \mathbf{Mod}_R \]
    and
    \[ \Hom_R(-, P) : \mathbf{Mod}_R^\cop \to \mathbf{Mod}_R \]
    are functors, with action on morphisms \( f : N' \to N \) given by
    \[ \Hom_R(Q, f)(\varphi) = f \circ \varphi = f_\star(\varphi) : \Hom_R(Q, N') \to \Hom_R(Q, N') \]
    and
    \[ \Hom_R(f, P)(\varphi) = \varphi \circ f = f^\star(\varphi) : \Hom_R(N, Q) \to \Hom_R(N', Q) \]
\end{definition}
\begin{proposition}
    Suppose
    \[\begin{tikzcd}
        0 & A & B & C
        \arrow[from=1-1, to=1-2]
        \arrow["f", from=1-2, to=1-3]
        \arrow["g", from=1-3, to=1-4]
    \end{tikzcd}\]
    is exact.
    Then, so is
    \[\begin{tikzcd}
        0 & {\Hom_R(Q, A)} & {\Hom_R(Q, B)} & {\Hom_R(Q, C)}
        \arrow[from=1-1, to=1-2]
        \arrow["{f_\star}", from=1-2, to=1-3]
        \arrow["{g_\star}", from=1-3, to=1-4]
    \end{tikzcd}\]
    Thus, the covariant hom-functor is \emph{left exact}.
\end{proposition}
\begin{proof}
    First, we show \( f_\star \) is injective.
    Suppose \( f_\star(\varphi) = 0 \), so \( f \circ \varphi = 0 \).
    Then as \( f \) is injective, \( f(\varphi(x)) = 0 \) implies \( \varphi(x) = 0 \), giving \( \varphi = 0 \) as required.

    Now consider \( \varphi : Q \to A \).
    Then
    \[ g_\star (f_\star(\varphi)) = g \circ (f \circ \varphi) = (g \circ f) \circ \varphi = 0 \circ \varphi = 0 \]
    so \( \im f_\star \subseteq \ker g_\star \).
    Now suppose \( \varphi : Q \to B \) has \( g_\star(\varphi) = g \circ \varphi = 0 \).
    So for all \( x \in Q \), \( g(\varphi(x)) = 0 \).
    By exactness of the original sequence, \( \varphi(x) \in \im f \).
    As \( f \) is injective, \( \varphi(x) \) has a unique preimage \( \psi(x) \) under \( f \).
    As \( f \) is \( R \)-linear, so is \( \psi : Q \to A \).
    Hence \( f_\star(\psi) = \varphi \) as required.
\end{proof}
\begin{proposition}
    Suppose
    \[\begin{tikzcd}
        A & B & C & 0
        \arrow["f", from=1-1, to=1-2]
        \arrow["g", from=1-2, to=1-3]
        \arrow[from=1-3, to=1-4]
    \end{tikzcd}\]
    is exact.
    Then, so is
    \[\begin{tikzcd}
        0 & {\Hom_R(C, P)} & {\Hom_R(B, P)} & {\Hom_R(A, P)}
        \arrow[from=1-1, to=1-2]
        \arrow["{g^\star}", from=1-2, to=1-3]
        \arrow["{f^\star}", from=1-3, to=1-4]
    \end{tikzcd}\]
    Thus, the contravariant hom-functor is also left-exact.
\end{proposition}
\begin{proof}
    First, we show \( g^\star \) is injective.
    Suppose \( g^\star(\varphi) = 0 \), so \( \varphi \circ g = 0 \).
    As \( g \) is surjective, we must have \( \varphi = 0 \).

    Now consider \( \varphi : C \to P \).
    Then
    \[ f^\star(g^\star(\varphi)) = (\varphi \circ g) \circ f = \varphi \circ (g \circ f) = \varphi \circ 0 = 0 \]
    so \( \im g^\star \subseteq \ker f^\star \).
    Now suppose \( \varphi : B \to P \) has \( f^\star(\varphi) = \varphi \circ f = 0 \).
    So for all \( x \in A \), \( \varphi(f(x)) = 0 \).
    Define \( \psi : C \to P \) by
    \[ \psi(g(x)) = \varphi(x) \]
    We show this is well-defined.
    If \( g(x) = g(y) \), then \( g(x - y) = 0 \), so \( x - y = f(a) \) for some \( a \in A \).
    But then \( \varphi(f(a)) = 0 \), so \( \varphi(x) = \varphi(y) \).
    As \( \varphi \) and \( g \) are \( R \)-linear, so is \( \psi \).
    Hence \( g^\star(\psi) = \varphi \) as required.
\end{proof}
\begin{lemma}
    Consider a sequence of \( R \)-modules
    \[\begin{tikzcd}
        A & B & C
        \arrow["f", from=1-1, to=1-2]
        \arrow["g", from=1-2, to=1-3]
    \end{tikzcd}\]
    Suppose that for each \( R \)-module \( P \),
    \[\begin{tikzcd}
        {\Hom_R(C, P)} & {\Hom_R(B, P)} & {\Hom_R(A, P)}
        \arrow["{g^\star}", from=1-1, to=1-2]
        \arrow["{f^\star}", from=1-2, to=1-3]
    \end{tikzcd}\]
    is exact.
    Then the original sequence
    \[\begin{tikzcd}
        A & B & C
        \arrow["f", from=1-1, to=1-2]
        \arrow["g", from=1-2, to=1-3]
    \end{tikzcd}\]
    is exact.
\end{lemma}
\begin{proof}
    First, take \( P = C \).
    By hypothesis, the following sequence is exact.
    \[\begin{tikzcd}
        {\Hom_R(C, C)} & {\Hom_R(B, C)} & {\Hom_R(A, C)}
        \arrow["{g^\star}", from=1-1, to=1-2]
        \arrow["{f^\star}", from=1-2, to=1-3]
    \end{tikzcd}\]
    Consider
    \[ \id_C \mapsto \id_C \circ g \mapsto \id_C \circ g \circ f \]
    By exactness, \( \id_C \) must be mapped to zero under \( f^\star \circ g^\star \), so \( g \circ f = 0 \).
    Hence \( \im f \subseteq \ker g \).

    Now, take \( P = \faktor{B}{\im f} = \coker f \).
    \[\begin{tikzcd}
        {\Hom_R\qty(C, \faktor{B}{\im f})} & {\Hom_R\qty(B, \faktor{B}{\im f})} & {\Hom_R\qty(A, \faktor{B}{\im f})}
        \arrow["{g^\star}", from=1-1, to=1-2]
        \arrow["{f^\star}", from=1-2, to=1-3]
    \end{tikzcd}\]
    Let \( h : B \to \faktor{B}{\im f} \) be the quotient map.
    Then,
    \[ f^\star(h) = h \circ f;\quad h(f(x)) = 0 \]
    Thus by exactness, \( h \) has a preimage \( e : C \to \faktor{B}{\im f} \).
    Then \( g^\star(e) = e \circ g = h \), so \( \ker g \subseteq \ker h = \im f \), giving the reverse inclusion.
\end{proof}
By the universal property of the tensor product,
\[ \Hom_R(M \otimes_R N, L) \simeq \operatorname{Bilin}_R(M \times N, L) \simeq \Hom_R(N, \Hom_R(M, L)) \]
given by
\[ \varphi \mapsto (n \mapsto m \mapsto \varphi(m \otimes n)) ;\quad (m \otimes n \mapsto \varphi(m)(n)) \mapsfrom \varphi \]
This bijection is \emph{natural}, in the sense that many commutative diagrams involving them will commute.
\begin{proposition}
    Let \( M \) be an \( R \)-module.
    Then the functor \( T_M = M \otimes_R (-) \) is right exact.
\end{proposition}
\begin{proof}
    Consider an exact sequence of \( R \)-modules
    % https://q.uiver.app/#q=WzAsNCxbMCwwLCJBIl0sWzEsMCwiQiJdLFsyLDAsIkMiXSxbMywwLCIwIl0sWzAsMSwiZiJdLFsxLDIsImciXSxbMiwzXV0=
\[\begin{tikzcd}
	A & B & C & 0
	\arrow["f", from=1-1, to=1-2]
	\arrow["g", from=1-2, to=1-3]
	\arrow[from=1-3, to=1-4]
\end{tikzcd}\]
    We must show that
    % https://q.uiver.app/#q=WzAsNCxbMCwwLCJNIFxcb3RpbWVzX1IgQSJdLFsxLDAsIk0gXFxvdGltZXNfUiBCIl0sWzIsMCwiTSBcXG90aW1lc19SIEMiXSxbMywwLCIwIl0sWzAsMSwiXFxpZF9NIFxcb3RpbWVzIGYiXSxbMSwyLCJcXGlkX00gXFxvdGltZXMgZyJdLFsyLDNdXQ==
\[\begin{tikzcd}
	{M \otimes_R A} & {M \otimes_R B} & {M \otimes_R C} & 0
	\arrow["{\id_M \otimes f}", from=1-1, to=1-2]
	\arrow["{\id_M \otimes g}", from=1-2, to=1-3]
	\arrow[from=1-3, to=1-4]
\end{tikzcd}\]
    is exact.
    Let \( P \) be an \( R \)-module, and consider apply the functor \( \Hom(-, P) \) to this sequence.
    As this is left exact, the resulting sequence will be exact.
    % https://q.uiver.app/#q=WzAsNCxbMCwwLCIwIl0sWzEsMCwiXFxIb21fUihDLCBQKSJdLFsyLDAsIlxcSG9tX1IoQiwgUCkiXSxbMywwLCJcXEhvbV9SKEEsIFApIl0sWzAsMV0sWzEsMiwiZ15cXHN0YXIiXSxbMiwzLCJmXlxcc3RhciJdXQ==
\[\begin{tikzcd}
	0 & {\Hom_R(C, P)} & {\Hom_R(B, P)} & {\Hom_R(A, P)}
	\arrow[from=1-1, to=1-2]
	\arrow["{g^\star}", from=1-2, to=1-3]
	\arrow["{f^\star}", from=1-3, to=1-4]
\end{tikzcd}\]
    Then, apply the functor \( \Hom(M, -) \), which is also left exact.
    % https://q.uiver.app/#q=WzAsNCxbMCwwLCIwIl0sWzEsMCwiXFxIb21fUihNLCBcXEhvbV9SKEMsIFApKSJdLFsyLDAsIlxcSG9tX1IoTSwgXFxIb21fUihCLCBQKSkiXSxbMywwLCJcXEhvbV9SKE0sIFxcSG9tX1IoQSwgUCkpIl0sWzAsMV0sWzEsMiwiKGdeXFxzdGFyKV9cXHN0YXIiXSxbMiwzLCIoZl5cXHN0YXIpX1xcc3RhciJdXQ==
\[\begin{tikzcd}
	0 & {\Hom_R(M, \Hom_R(C, P))} & {\Hom_R(M, \Hom_R(B, P))} & {\Hom_R(M, \Hom_R(A, P))}
	\arrow[from=1-1, to=1-2]
	\arrow["{(g^\star)_\star}", from=1-2, to=1-3]
	\arrow["{(f^\star)_\star}", from=1-3, to=1-4]
\end{tikzcd}\]
    We thus obtain
    % https://q.uiver.app/#q=WzAsOCxbMCwxLCIwIl0sWzEsMSwiXFxIb21fUihNIFxcb3RpbWVzX1IgQywgUCkiXSxbMiwxLCJcXEhvbV9SKE0gXFxvdGltZXNfUiBCLCBQKSJdLFszLDEsIlxcSG9tX1IoTSBcXG90aW1lc19SIEEsIFApIl0sWzAsMCwiMCJdLFsxLDAsIlxcSG9tX1IoTSwgXFxIb21fUihDLCBQKSkiXSxbMiwwLCJcXEhvbV9SKE0sIFxcSG9tX1IoQiwgUCkpIl0sWzMsMCwiXFxIb21fUihNLCBcXEhvbV9SKEEsIFApKSJdLFswLDFdLFsxLDJdLFsyLDNdLFs0LDVdLFs1LDZdLFs2LDddLFs3LDMsIlxcc2ltZXEiXSxbNiwyLCJcXHNpbWVxIl0sWzUsMSwiXFxzaW1lcSJdLFs0LDAsIlxcc2ltZXEiXV0=
\[\begin{tikzcd}
	0 & {\Hom_R(M, \Hom_R(C, P))} & {\Hom_R(M, \Hom_R(B, P))} & {\Hom_R(M, \Hom_R(A, P))} \\
	0 & {\Hom_R(M \otimes_R C, P)} & {\Hom_R(M \otimes_R B, P)} & {\Hom_R(M \otimes_R A, P)}
	\arrow[from=2-1, to=2-2]
	\arrow[from=2-2, to=2-3]
	\arrow[from=2-3, to=2-4]
	\arrow[from=1-1, to=1-2]
	\arrow[from=1-2, to=1-3]
	\arrow[from=1-3, to=1-4]
	\arrow["\simeq", from=1-4, to=2-4]
	\arrow["\simeq", from=1-3, to=2-3]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["\simeq", from=1-1, to=2-1]
\end{tikzcd}\]
    As this diagram commutes, the bottom sequence is exact.
    Since this holds for all \( P \), by the previous lemma, we can cancel \( P \) to give exact sequences
\[\begin{tikzcd}
	0 & {M \otimes_R C} & {M \otimes_R B}
	\arrow[from=1-2, to=1-3]
	\arrow[from=1-1, to=1-2]
\end{tikzcd}
\quad\quad
\begin{tikzcd}
	{M \otimes_R C} & {M \otimes_R B} & {M \otimes_R A}
	\arrow[from=1-1, to=1-2]
	\arrow[from=1-2, to=1-3]
\end{tikzcd}\]
    which combine into the longer sequence as required.
\end{proof}
\begin{remark}
    It is not the case that if
    % https://q.uiver.app/#q=WzAsMyxbMCwwLCJBIl0sWzEsMCwiQiJdLFsyLDAsIkMiXSxbMCwxXSxbMSwyXV0=
\[\begin{tikzcd}
	A & B & C
	\arrow[from=1-1, to=1-2]
	\arrow[from=1-2, to=1-3]
\end{tikzcd}\]
    is exact, then
    % https://q.uiver.app/#q=WzAsMyxbMCwwLCJNIFxcb3RpbWVzX1IgQSJdLFsxLDAsIk0gXFxvdGltZXNfUiBCIl0sWzIsMCwiTSBcXG90aW1lc19SIEMiXSxbMCwxXSxbMSwyXV0=
\[\begin{tikzcd}
	{M \otimes_R A} & {M \otimes_R B} & {M \otimes_R C}
	\arrow[from=1-1, to=1-2]
	\arrow[from=1-2, to=1-3]
\end{tikzcd}\]
    is also exact; the fact that the sequence has a zero on the right is important.
    Consider the exact sequence
    % https://q.uiver.app/#q=WzAsMyxbMCwwLCIwIl0sWzEsMCwiXFxtYXRoYmIgWiJdLFsyLDAsIlxcbWF0aGJiIFoiXSxbMCwxXSxbMSwyLCJcXHRpbWVzIDIiXV0=
\[\begin{tikzcd}
	0 & {\mathbb Z} & {\mathbb Z}
	\arrow[from=1-1, to=1-2]
	\arrow["{\times 2}", from=1-2, to=1-3]
\end{tikzcd}\]
    and tensor with \( \faktor{\mathbb Z}{2\mathbb Z} \).
    We would then obtain
    % https://q.uiver.app/#q=WzAsNixbMCwwLCIwIl0sWzEsMCwiXFxmYWt0b3J7XFxtYXRoYmIgWn17MlxcbWF0aGJiIFp9IFxcb3RpbWVzIFxcbWF0aGJiIFoiXSxbMiwwLCJcXGZha3RvcntcXG1hdGhiYiBafXsyXFxtYXRoYmIgWn0gXFxvdGltZXMgXFxtYXRoYmIgWiJdLFswLDEsIjAiXSxbMSwxLCJcXGZha3RvcntcXG1hdGhiYiBafXsyXFxtYXRoYmIgWn0iXSxbMiwxLCJcXGZha3RvcntcXG1hdGhiYiBafXsyXFxtYXRoYmIgWn0iXSxbMCwxXSxbMSwyXSxbMCwzLCJcXHNpbWVxIl0sWzEsNCwiXFxzaW1lcSJdLFsyLDUsIlxcc2ltZXEiXSxbMyw0XSxbNCw1XV0=
\[\begin{tikzcd}
	0 & {\faktor{\mathbb Z}{2\mathbb Z} \otimes \mathbb Z} & {\faktor{\mathbb Z}{2\mathbb Z} \otimes \mathbb Z} \\
	0 & {\faktor{\mathbb Z}{2\mathbb Z}} & {\faktor{\mathbb Z}{2\mathbb Z}}
	\arrow[from=1-1, to=1-2]
	\arrow["\times 2", from=1-2, to=1-3]
	\arrow["\simeq", from=1-1, to=2-1]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["\simeq", from=1-3, to=2-3]
	\arrow[from=2-1, to=2-2]
	\arrow["\times 2", from=2-2, to=2-3]
\end{tikzcd}\]
    but this sequence is not exact.
\end{remark}

\subsection{Flat modules}
\begin{definition}
    An \( R \)-module \( M \) is \emph{flat} if whenever \( f : N \to N' \) is \( R \)-linear and injective, the map
    \[ \id_M \otimes f : M \otimes_R N \to M \otimes_R N' \]
    is injective.
\end{definition}
\begin{example}
    \begin{enumerate}
        \item \( \faktor{\mathbb Z}{2\mathbb Z} \) is not a flat \( \mathbb Z \)-module.
        \item Free modules are flat.
        Suppose \( f : N \to N' \) is an injective \( R \)-linear map.
        Then
        % https://q.uiver.app/#q=WzAsNCxbMCwwLCJSXntcXG9wbHVzIEl9IFxcb3RpbWVzX1IgTiJdLFsxLDAsIlJee1xcb3BsdXMgSX0gXFxvdGltZXNfUiBOJyJdLFsxLDEsIihOJylee1xcb3BsdXMgSX0iXSxbMCwxLCJOXntcXG9wbHVzIEl9Il0sWzAsMSwiXFxpZF97Ul57XFxvcGx1cyBJfX0gXFxvdGltZXMgZiJdLFsxLDIsIlxcc2ltZXEiXSxbMCwzLCJcXHNpbWVxIiwyXSxbMywyLCJnIiwyXV0=
\[\begin{tikzcd}
	{R^{\oplus I} \otimes_R N} & {R^{\oplus I} \otimes_R N'} \\
	{N^{\oplus I}} & {(N')^{\oplus I}}
	\arrow["{\id_{R^{\oplus I}} \otimes f}", from=1-1, to=1-2]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["\simeq"', from=1-1, to=2-1]
	\arrow["g"', from=2-1, to=2-2]
\end{tikzcd}\]
        commutes, where
        \[ g((n_i)_{i \in I}) = (f(n_i))_{i \in I} \]
        But \( g \) is injective, so \( \id_{R^{\oplus I}} \otimes f \) must also be injective.
        \item The base ring matters. One can see that \( \faktor{\mathbb Z}{2\mathbb Z} \) is not a flat \( \mathbb Z \)-module but it is a flat \( \faktor{\mathbb Z}{2\mathbb Z} \)-module as it is a free \( \faktor{\mathbb Z}{2\mathbb Z} \)-module.
    \end{enumerate}
\end{example}
\begin{definition}
    An \( R \)-module \( M \) is \emph{torsion-free} if \( rm \neq 0 \) whenever \( r \) is not a zero divisor in \( R \) and \( m \neq 0 \).
\end{definition}
\begin{proposition}
    Flat modules are torsion-free.
\end{proposition}
\begin{proof}
    Suppose \( M \) is not torsion-free.
    Then there is \( r_0 \in R \) not a zero divisor and \( m_0 \neq 0 \), such that \( r_0 m_0 = 0 \).
    Consider the \( R \)-linear map \( f : R \to R \) given by multiplication by \( r_0 \).
    Its kernel is zero, as \( r_0 \) is not a zero divisor.
    So \( f \) is injective.
    The following diagram commutes.
    % https://q.uiver.app/#q=WzAsNCxbMCwwLCJNIFxcb3RpbWVzX1IgUiJdLFsxLDAsIk0gXFxvdGltZXNfUiBSIl0sWzEsMSwiTSJdLFswLDEsIk0iXSxbMCwxLCJcXGlkX00gXFxvdGltZXMgZiJdLFsxLDIsIlxcc2ltZXEiXSxbMCwzLCJcXHNpbWVxIiwyXSxbMywyLCJtIFxcbWFwc3RvIHJfMCBtIiwyXV0=
\[\begin{tikzcd}
	{M \otimes_R R} & {M \otimes_R R} \\
	M & M
	\arrow["{\id_M \otimes f}", from=1-1, to=1-2]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["\simeq"', from=1-1, to=2-1]
	\arrow["{m \mapsto r_0 m}"', from=2-1, to=2-2]
\end{tikzcd}\]
    If \( M \) were flat, \( \id_M \otimes f \) would be injective, but then the map \( m \mapsto r_0 m \) would also be injective, which is a contradiction.
\end{proof}
% note: all integral domains are nonzero. we want the definition to really be: the zero ideal is prime.
\begin{example}
    Let \( R \) be an integral domain, and let \( I \) be a nonzero ideal of \( R \).
    Then \( \faktor{R}{I} \) is not flat.
    Indeed, if \( I = R \) then \( \faktor{R}{I} = 0 \) is not flat.
    Instead, suppose \( I \subsetneq R \), and let \( 0 \neq x \in I \).
    Tensoring with \( \faktor{R}{I} \), the map \( \faktor{R}{I} \to \faktor{R}{I} \) given by multiplication by \( x \) is the zero map, but \( \faktor{R}{I} \) is not the zero module, so \( \faktor{R}{I} \) is not torsion-free.
\end{example}
\begin{proposition}
    Let \( M \) be an \( R \)-module.
    Then the following are equivalent.
    \begin{enumerate}
        \item \( T_M \) preserves exactness of all exact sequences;
        \item \( T_M \) preserves exactness of short exact sequences;
        \item \( M \) is flat;
        \item if \( f : N \to N' \) is \( R \)-linear and injective, and \( N, N' \) are finitely generated \( R \)-modules, then \( \id_M \otimes f \) is injective.
    \end{enumerate}
\end{proposition}
Note that a map \( f : M \to N \) is injective exactly when the sequence
% https://q.uiver.app/#q=WzAsNCxbMCwwLCJNIFxcb3RpbWVzX1IgUiJdLFsxLDAsIk0gXFxvdGltZXNfUiBSIl0sWzEsMSwiTSJdLFswLDEsIk0iXSxbMCwxLCJcXGlkX00gXFxvdGltZXMgZiJdLFsxLDIsIlxcc2ltZXEiXSxbMCwzLCJcXHNpbWVxIiwyXSxbMywyLCJtIFxcbWFwc3RvIHJfMCBtIiwyXV0=
\[\begin{tikzcd}
	{M \otimes_R R} & {M \otimes_R R} \\
	M & M
	\arrow["{\id_M \otimes f}", from=1-1, to=1-2]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["\simeq"', from=1-1, to=2-1]
	\arrow["{m \mapsto r_0 m}"', from=2-1, to=2-2]
\end{tikzcd}\]
is exact, so all of these conditions relate exact sequences.
\begin{proof}
    Note that (i) implies (ii) which implies (iii) which implies (iv).

    \emph{(ii) implies (i).}
    Suppose the sequence
    % https://q.uiver.app/#q=WzAsMyxbMCwwLCJBIl0sWzEsMCwiQiJdLFsyLDAsIkMiXSxbMCwxLCJmIl0sWzEsMiwiZyJdXQ==
\[\begin{tikzcd}
	A & B & C
	\arrow["f", from=1-1, to=1-2]
	\arrow["g", from=1-2, to=1-3]
\end{tikzcd}\]
    is exact.
    Then, the following diagram is exact.
    % https://q.uiver.app/#q=WzAsMTMsWzIsMiwiQSJdLFs0LDIsIkIiXSxbNiwyLCJDIl0sWzEsMSwiXFxrZXIgZiJdLFszLDMsIlxcSW0gZiA9IFxca2VyIGciXSxbNCw0LCIwIl0sWzAsMCwiMCJdLFsyLDQsIjAiXSxbNSwxLCJcXEltIGciXSxbNiwwLCIwIl0sWzQsMCwiMCJdLFs3LDMsIlxcY29rZXIgZyJdLFs4LDQsIjAiXSxbMCwxLCJmIl0sWzEsMiwiZyJdLFszLDBdLFswLDRdLFs0LDVdLFs2LDNdLFs3LDRdLFs0LDFdLFsxLDhdLFs4LDldLFsxMCw4XSxbOCwyXSxbMiwxMV0sWzExLDEyXV0=
\[\begin{tikzcd}[column sep=small]
	0 &&&& 0 && 0 \\
	& {\ker f} &&&& {\im g} \\
	&& A && B && C \\
	&&& {\im f = \ker g} &&&& {\coker g} \\
	&& 0 && 0 &&&& 0
	\arrow["f", from=3-3, to=3-5]
	\arrow["g", from=3-5, to=3-7]
	\arrow[from=2-2, to=3-3]
	\arrow[from=3-3, to=4-4]
	\arrow[from=4-4, to=5-5]
	\arrow[from=1-1, to=2-2]
	\arrow[from=5-3, to=4-4]
	\arrow[from=4-4, to=3-5]
	\arrow[from=3-5, to=2-6]
	\arrow[from=2-6, to=1-7]
	\arrow[from=1-5, to=2-6]
	\arrow[from=2-6, to=3-7]
	\arrow[from=3-7, to=4-8]
	\arrow[from=4-8, to=5-9]
\end{tikzcd}\]
    After applying \( T = T_M \), the diagram still commutes, and the diagonal lines remain exact.
    \begin{align*}
        \im(TA \to TB) &= \im(TA \to T(\im f) \to TB) \\
        &= \im (T(\im f) \to TB) \\
        &= \ker (TB \to T(\im g)) \\
        &= \ker (TB \to T(\im g) \to TC) \\
        &= \ker (TB \to TC)
    \end{align*}

    \emph{(iii) implies (ii).}
    \( T_M \) is right exact.
    % write in more detail. need to use flatness to do the LHS of the sequence.

    \emph{(iv) implies (iii).}
    % todo: use prop above about being zero in finitely generated submodules
\end{proof}
\begin{proposition}
    Let \( f : R \to S \) be a ring homomorphism, and let \( M \) be a flat \( R \)-module.
    Then \( S \otimes_R M \) is a flat \( S \)-module.
\end{proposition}
\begin{proof}
    Let \( g : N \to N' \) be an \( S \)-linear injective map.
    Then
\[\begin{tikzcd}
	{(S \otimes_R M) \otimes_S N} & {(S \otimes_R M) \otimes_S N'} \\
	{M \otimes_R N} & {M \otimes_R N'}
	\arrow["{\id_M \otimes g}"', from=2-1, to=2-2]
	\arrow["\simeq"', from=1-1, to=2-1]
	\arrow["\simeq", from=1-2, to=2-2]
	\arrow["{\id_{S \otimes_R M} \otimes g}", from=1-1, to=1-2]
\end{tikzcd}\]
    commutes.
    The map \( \id_M \otimes g \) is injective as \( M \) is flat, so the map \( \id_{S \otimes_R M} \otimes g \) is also injective.
    Thus \( S \otimes_R M \) is a flat \( S \)-module.
\end{proof}
We now explore some further examples of tensor products.
\begin{example}
    Consider \( \mathbb Q \otimes_{\mathbb Z} \faktor{\mathbb Z}{n\mathbb Z} \).
    In this ring,
    \[ x \otimes y = n \cdot \frac{x}{n} \otimes y = \frac{x}{n} \otimes ny = \frac{x}{n} \otimes 0 = 0 \]
    So this ring is trivial.
    To prove this, we used the fact that for all \( x \in \mathbb Q \) and \( n \geq 1 \), there is an element \( y \in \mathbb Q \) such that \( ny = x \).
    We say that \( \mathbb Q \) is a \emph{divisible group}.
    We also needed the fact that \( \faktor{\mathbb Z}{n\mathbb Z} \) is a \emph{torsion group}: all elements are of finite order.
    Hence the tensor product of a divisible group with a torsion group is zero.
    In particular, it follows that
    \[ \faktor{\mathbb Q}{\mathbb Z} \otimes_{\mathbb Z} \faktor{\mathbb Q}{\mathbb Z} = 0 \]
    However, for an \( R \)-module \( M \neq 0 \), if \( M \) is finitely generated then \( M \otimes_R M \neq 0 \).
\end{example}
\begin{example}
    Let \( V \) be a vector space over \( \mathbb Q \).
    Then \( \mathbb Q \otimes_{\mathbb Q} V \cong V \) as \( \mathbb Q \)-modules, given by the map \( x \otimes v \mapsto xv \).
    However, \( \mathbb Q \otimes_{\mathbb Z} V \) is also isomorphic to \( V \), given by the same map.
    First, note that every tensor in \( \mathbb Q \otimes_{\mathbb Z} V \) is pure.
    \[ \sum \frac{a_i}{b_i} \otimes v_i = \sum \frac{1}{b_i} \otimes a_i v_i = \sum \frac{1}{b_i} \otimes b_i \frac{a_i}{b_i} v_i = \sum 1 \otimes \frac{a_i}{b_i} v_i = 1 \otimes \sum \frac{a_i}{b_i} v_i \]
    Surjectivity of the map is clear as \( 1 \otimes v \to v \).
    We check injectivity on pure tensors.
    If \( xv = 0 \), then \( x = 0 \) or \( v = 0 \), and in any case, \( x \otimes v = 0 \).
\end{example}
\begin{example}
    Consider
    \[ M \otimes_R \qty(\bigoplus_{i \in I} N_i) \simeq \bigoplus_{i \in I} \qty(M \otimes_R N_i) \]
    given by \( m \otimes (n_i)_{i \in I} \mapsto (m \otimes n_i)_{i \in I} \).
    This is not true with the direct product.
    However, we do have a map
    \[ M \otimes_R \qty(\prod_{i \in I} N_i) \to \prod_{i \in I} \qty(M \otimes_R N_i) \]
    given by the same formula, but this is in general not an isomorphism.
    Consider
    \[ \mathbb Q \otimes_{\mathbb Z} \prod_{n = 1}^\infty \faktor{\mathbb Z}{2^n \mathbb Z} \to \prod_{n = 1}^\infty \qty(\mathbb Q \otimes_{\mathbb Z} \faktor{\mathbb Z}{2^n \mathbb Z}) \]
    The right-hand side is zero, as each factor is a tensor product of a divisible group by a torsion group.
    However, the left-hand side is nonzero.
    Let
    \[ g = (1, 1, 1, \dots) \in \prod_{n = 1}^\infty \faktor{\mathbb Z}{2^n \mathbb Z} \]
    This is an element of infinite order, so \( \langle g \rangle \simeq \mathbb Z \) as a subgroup of \( \prod_{n = 1}^\infty \faktor{\mathbb Z}{2^n \mathbb Z} \).
    Thus
    \[ \mathbb Q \otimes_{\mathbb Z} \langle g \rangle \simeq \mathbb Q \]
    as \( \mathbb Z \)-modules.
    But we have an injective inclusion map
    \[ \langle g \rangle \to \prod_{n = 1}^\infty \faktor{\mathbb Z}{2^n \mathbb Z} \]
    We will later show that \( \mathbb Q \) is a flat \( \mathbb Z \)-module.
    This justifies the fact that there is an inclusion
    \[ \mathbb Q \otimes_{\mathbb Z} \langle g \rangle \rightarrowtail \mathbb Q \otimes_{\mathbb Z} \prod_{n = 1}^\infty \faktor{\mathbb Z}{2^n \mathbb Z} \]
    showing that in particular the module in question is nonzero.
\end{example}
\begin{example}
    Consider \( \mathbb C \otimes_{\mathbb R} \mathbb C \).
    We will choose to extend scalars on the left, treating the right-hand copy of \( \mathbb C \) as an \( \mathbb R \)-module isomorphic to \( \mathbb R^2 \).
    As a module, \( \mathbb C \otimes_{\mathbb R} \mathbb C \simeq \mathbb C \otimes_{\mathbb R} \mathbb R^2 \) is isomorphic to \( \mathbb C^2 \).
    The basis for \( \mathbb C^2 \) is given by \( 1 \otimes 1, 1 \otimes i \).

    As a \( \mathbb C \)-algebra, we again choose to extend scalars on the left, considering the right-hand copy of \( \mathbb C \) as an \( \mathbb R \)-algebra.
    \begin{align*}
        \mathbb C \otimes_{\mathbb R} \mathbb C &\simeq \mathbb C \otimes_{\mathbb R} \faktor{\mathbb R[T]}{(T^2 + 1)} \\
        &\simeq \faktor{\mathbb C[T]}{(T^2 + 1)} \\
        &\simeq \faktor{\mathbb C[T]}{(T-i)(T+i)} \\
        &\simeq \faktor{\mathbb C[T]}{(T-i)} \times \faktor{\mathbb C[T]}{(T+i)} \\
        &\simeq \mathbb C \times \mathbb C
    \end{align*}
    using the Chinese remainder theorem, which will be explored later.
    The action of this isomorphism on a pure tensor is
    \begin{align*}
        x \otimes y = (a + bi) \otimes (c + di) &\mapsto (a + bi) \otimes (c + dT + (T^2 + 1)\mathbb R[T]) \\
        &\mapsto (a + bi)(c + dT) + (T^2 + 1)\mathbb C[T] \\
        &= \underbrace{(ac + bdiT) + (ibc + adT)}_{P} + (T^2 + 1) \mathbb C[T] \\
        &\mapsto (P + (T - i) \mathbb C[T], P + (T + i) \mathbb C[T]) \\
        &\mapsto ((ac - bd) + i(bc + ad), (ac + bd) + i(bc - ad)) = (xy, x \overline{y})
    \end{align*}
\end{example}
